package com.example.springboot2.xdkt.controller;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.HashMap;
import java.util.Map;

//测试http协议的post,del,put请求
public class OtherHttpController {

    private Map<String, Object> params = new HashMap<>();



    //post一般用于保存
    @PostMapping("/v1/login")
    public Object login(String id, String pwd){
        params.clear();
        params.put("id", id);
        params.put("pwd", pwd);
        return params;
    }


    //put一般用于更新
    @PutMapping("/v1/put")
    public Object put(String id) {
        params.clear();
        params.put("id", id);
        return params;
    }


    //delete一般用于删除
    @DeleteMapping("/v1/del")
    public Object del(String id) {
        params.clear();
        params.put("id", id);
        return params;
    }


}
